feat: better logs when a file cannot be removed
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Tue, 22 Apr 2025 09:14:07 +0000 (11:14 +0200)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Thu, 24 Apr 2025 08:34:05 +0000 (08:34 +0000)
should log the reason why a file cannot be deleted

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/common/filesystembase.cpp

index b63f6c1a7e156864d68897f792a55d7212913512..7ab136b42df314214c0620fe29a8ea1f6b9099be 100644 (file)
@@ -595,6 +595,7 @@ bool FileSystem::remove(const QString &fileName, QString *errorString)
             if (errorString) {
                 *errorString = QObject::tr("File is already deleted");
             }
+            qCWarning(lcFileSystem()) << "File is already deleted" << fileName;
             return false;
         }
     }
@@ -603,6 +604,7 @@ bool FileSystem::remove(const QString &fileName, QString *errorString)
         if (errorString) {
             *errorString = QString::fromLatin1(e.what());
         }
+        qCWarning(lcFileSystem()) << e.what() << fileName;
         return false;
     }
     catch (...)
@@ -610,6 +612,7 @@ bool FileSystem::remove(const QString &fileName, QString *errorString)
         if (errorString) {
             *errorString = QObject::tr("Error deleting the file");
         }
+        qCWarning(lcFileSystem()) << "Error deleting the file" << fileName;
         return false;
     }